package com.lbn.monitor.util;

import android.os.Handler;
import android.os.Looper;

/**
 * Created by free on 2015/10/17.
 */
public class UIHandler {

    private static Handler mUIHandler = null;

    private UIHandler() {
    }

    public static void initUIHanlder(Looper looper) {
        if(mUIHandler==null){
            synchronized (UIHandler.class){
                if(mUIHandler==null){
                    mUIHandler = new Handler(looper);
                }
            }
        }
    }

    public static void postDelayed(Runnable r, long delayMillis) {
        mUIHandler.postDelayed(r, delayMillis);
    }

    public static void post(Runnable r) {
        mUIHandler.post(r);
    }

    public static void remove(Runnable r) {
        mUIHandler.removeCallbacks(r);
    }

}
